package com.example.secondhandspringboot.utils;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import java.util.stream.Collectors;

public class CodeUtil {

    /**
     * 获取验证码
     * @return
     */
    public static String getCode(){
        Random random = new Random();
        StringBuilder code = new StringBuilder();
        while(code.length()<4){
            int i = random.nextInt(10);
            code.append(i);
        }
        return code.toString();
    }
}
